import random
from datetime import datetime, timedelta
comment_id = [
    1, 2, 21, 31, 41, 51, 61, 71, 
    1567, 2789, 3478, 3967, 
    4591, 4826, 6123, 7345, 
    8210, 8934
]

user_id = [
    1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
    11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
    21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
    31, 32, 33, 34, 35, 36, 37, 38, 39, 42,
    48, 56, 61, 65, 71, 89, 92, 171, 232, 347,
    371
]

# 用于存储已经输出的组合
used_combinations = set()

prefix=  '''INSERT INTO user_comment_likes (user_id, comment_id, create_time) VALUES'''
# 循环八十次
for _ in range(80):
    # 随机选择一个comment_id和一个user_id
    cid = random.choice(comment_id)
    uid = random.choice(user_id)
    
    combination = (uid,cid)
    
    # 如果组合已经存在，则重新选择，直到找到一个未使用的组合
    while combination in used_combinations:
        cid = random.choice(comment_id)
        uid = random.choice(user_id)
        combination = (uid,cid)
    
    # 输出组合
    # print(combination)

    # 随机生成时间,格式为2025-02-21 08:15:32,且时间均位于2025年02月21日00:00之后
    start_time = datetime(2025, 2, 21, 0, 0, 0)
    random_time = start_time + timedelta(seconds=random.randint(0, 86399))

    time = random_time.strftime('%Y-%m-%d %H:%M:%S')

    sql_str = prefix + f'''({combination[0]}, {combination[1]}, '{time}');'''
    print(sql_str)

    
    
    # 将组合添加到已使用的组合集合中
    used_combinations.add(combination)


